<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //var obj2 = Object.create();
        //console.log(obj2);//Object prototype may only be an Object or null: undefined
        //1.创建一个继承指定对象的对象
        var exp = {
            student:[{name:"laowang",
            age:14,
            eat:function(){
                console.log("hello");
            }},
            [{name:"laowang",
            age:14,
            eat:function(){
                console.log("hello");
            }}]
        ]
        };
        var obj2 = Object.create(exp);
        console.log(obj2);

        //2.创建一个普通类型的对象
        var obj3 = Object.create({});
        console.log(obj3);

        //3.创建一个没有没有隐式原型的对象
        var obj4 = Object.create(null);
        console.log(obj4);

        //深拷贝方法2
        var obj = JSON.stringify(exp);
        console.log(obj);
        var obj_json = JSON.parse(obj);
        var obj_n = obj_json;
        console.log(obj_json);
    </script>
</body>
</html>